<?php

declare (strict_types=1);
/**
 * @copyright 深圳市易果网络科技有限公司
 * @version 1.0.0
 * @link https://dayiguo.com
 */

namespace App\Dao;

use App\Exception\CustomException;
use App\Kernel\Traits\DaoTrait;

use App\Model\ScanOrdersRefunds;

use Hyperf\DbConnection\Db;
use Hyperf\Di\Annotation\Inject;

/**
 * class
 *
 * @author 张昊(2396675557@qq.com)
 * @package App\Dao
 */
class ScanOrderRefundsDao extends Dao
{

    use DaoTrait;

    /**
     * @inheritDoc
     */
    public function model(): string
    {
        return ScanOrdersRefunds::class;
    }

    /**
     * 通过条件查询单条数据
     * @param array $map
     * @return mixed
     */
    public function first(array $map)
    {
        return ScanOrdersRefunds::query()
            ->where(function ($query) use ($map) {
                return queryWhere($query, $map);
            })
            ->select('id','title','created_at')
            ->first();
    }

    /**
     * 新增
     * @param array $data
     * @return mixed
     */
    public function create(array $data)
    {
        return ScanOrdersRefunds::query()->create($data);
    }
}